// Author: combacsa@kaist.ac.kr
// http://www.jungol.co.kr/prog/Hanal/hanalView.php?qs_code=1988

//#define COMPILE_P1988
#ifdef COMPILE_P1988


#include <stdio.h>

int main() {
	int n = 0, id = 0, source = 1, destination = 3;
	long long int k = 0, power = 1, steps = 0;

	FILE *fi = fopen("input.txt", "r");
	fscanf(fi, "%d %lld", &n, &k);
	fclose(fi);

	for (int i = 1; i < n; i++, power *= 2);

	for (id = n; k != power; id--, power /= 2) {
		steps = power - 1;
		if (k <= steps) {
			destination = 6 - source - destination;
		} else {
			k -= power;
			source = 6 - source - destination;
		}
	}

	FILE *fo = fopen("output.txt", "w");
	fprintf(fo, "%d : %d -> %d", id, source, destination);
	fclose(fo);

	return 0;
}

#endif
